home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pn.arc
/
PNT1.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-08-12
|
3KB
|
97 lines
program PNT1(data, out, output, kbd);
{ PNT1.PAS #2.00 85-08-06 NORMAL PROBABILITY DISTRIBUTION TEST DRIVER
V02 L00 derived 85-08-06 by Dennis E. Hamilton for testing
of Turbo Pascal version, PN.PLB. This is a direct
clone of ERFT1.PAS.
V01 L02 completed on 79-03-22 by DEH for verifying erf(x)
and PN(x) using Benton Harbor Basic #5.01.01. }
var
data: text {source of test input values};
out: text {presentation of the test results};
x: real {test value from data };
px: real {known value for PN(x) to be checked};
{$I PN.PLB } {Vintage 2.00 definition for PN(x) }
procedure
commentary;
var c: char;
line: string[255];
begin {transfer comment lines (" in column 1) from the input data to the
output report until non-comment lines are produced.}
read(data, c);
while (c = '"') or (c = '/')
do begin
if c = '/'
then begin
writeln;
write('PNT1> Press any key to continue: ');
read(KBD, c);
ClrScr;
writeln('PNT1> #2.00 85-08-06 NORMAL PROBABILITY DISTRIBUTION',
' FUNCTION');
writeln;
end;
c := ' ';
{replacing the " by blank to indicate already noticed}
readln(data, line);
writeln(out, line);
if not eof(data)
then read(data, c);
end;
end {commentary};
BEGIN {PNT1.PAS}
CrtInit;
assign(out, 'CON:'); {or a filename for capturing the test report}
rewrite(out);
writeln(out, 'PNT1> #2.00 85-08-06 NORMAL PROBABILITY DISTRIBUTION',
' FUNCTION');
writeln(out);
assign(data, 'PNT1.DAT');
reset(data); {preparing to access the test data file.}
while not EOF(data)
do begin
commentary;
if not EOF(data)
then begin
readln(data, x, px); {test value and the expected value}
write(out, ' ');
if (abs(x) < 1.0E-8) or (abs(x) >= 10.0)
then if x < 0
then write(out, x :16)
else write(out, ' ', x :15)
else write(out, x :12:9, ' ');
write(out, ' ');
if abs(PN(x)) < 1.0E-8
then write(out, PN(x) :16)
else write(out, PN(x) :13:11, ' ');
writeln(out, ' ', abs(PN(x)-px) :8);
end;
end;
writeln(out);
close(data);
close(out);
CrtExit;
END. {PNT1}